<div id="sconfig" class="table-responsive col-sm-12">

    <form id="security" class="form-horizontal" ajax-submit="#main" action="{{ url }}" method="post"
            accept-charset="utf-8" role="form">

        <table class="table table-striped table-bordered table-hover" id="securitySetting">
            <thead>
            <tr>
                <th class="center">动作</th>
                {% for rKey,rValue in roles %}
                    <th class="center {{ rKey }}">{{ rValue['modelName'] }}</th>
                {% endfor %}
            </tr>
            </thead>

            <tbody>

            {% for saKey,saValue in securityList %}
                <tr>
                    <td>
                        <h4>{{ saValue['name'] }}</h4>
                        <p>{{ saValue['description'] }}</p>
                    </td>
                    {% for rKey,rValue in roles %}
                        <td class="center"><label> <input
                                        value="true" {% if security[saKey][rKey] is defined AND security[saKey][rKey] == true %}{{ 'checked' }}{% endif %}
                                        type="checkbox" class="ace ace-switch ace-switch-2"
                                        name="{{ saKey }}[{{ rKey }}]"><span class="lbl"></span>
                            </label></td>
                    {% endfor %}
                </tr>
            {% endfor %}

            </tbody>
        </table>

        <div class="clearfix form-actions">
            <button type="submit" class="btn btn-success btn-block">保存设置</button>
        </div>
    </form>
</div>
<div class="clear"></div>
<script type="text/javascript">
    jQuery(function ($) {
        $("#sconfig").chromatable({
            width: "100%",
            height: "100%",
            scrolling: "yes"
        })
    })
</script>
